package com.example.performance.r2dbc.entity.performance;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * RecordSetUtil class
 * @author ShiSheng Gao
 * @since  2023/04/23
 */

public class RecordSetUtil {
    private RecordSetUtil(){}

    public static Long getLong(ResultSet rs, String columnLabel) throws SQLException {
        return ResultSetUtil.getLong(rs, columnLabel);
    }

    public static Long getLong(ResultSet rs, int columnIndex) throws SQLException {
        return ResultSetUtil.getLong(rs, columnIndex);
    }

    public static Double getDouble(ResultSet rs, String columnLabel) throws SQLException {
        return ResultSetUtil.getDouble(rs, columnLabel);
    }

    public static Double getDouble(ResultSet rs, int columnIndex) throws SQLException {
        return ResultSetUtil.getDouble(rs, columnIndex);
    }

    public static String getString(ResultSet rs, String columnLabel) throws SQLException {
        return rs.getString(columnLabel);
    }

    public static String getString(ResultSet rs, int columnIndex) throws SQLException {
        return rs.getString(columnIndex);
    }

    static Integer getStatus(ResultSet rs) throws SQLException {
        Integer status = ResultSetUtil.getInteger(rs, "STATUT");
        return status == null ? 0 : status;
    }

    static Integer getStatus(ResultSet rs, int index) throws SQLException {
        Integer status = ResultSetUtil.getInteger(rs, index);
        return status == null ? 0 : status;
    }
}
